package com.demo.attBcollectionapi;

import java.util.HashMap;
import java.util.Map;

public class MapDemo {
	
	private static Map<Integer, String> map = new HashMap<Integer, String>(){{
		put(1, "aaa");
	}};
	
	static void getOrDefaultDemo(){
		System.out.println(map.getOrDefault(2, "bbb"));
	}
	
	static void computeIfAbsentDemo(){
		System.out.println(map.computeIfAbsent(3, x -> x + "ccc"));
	}
	
	public static void main(String[] args) {
		getOrDefaultDemo();
		computeIfAbsentDemo();
	}

}
